<?php

namespace app\common\model\offer;

use app\common\model\BaseModel;


class GoodsDetailModel extends BaseModel
{
    protected $table = 'offer_goods_detail';

    public function _formatList($list){
        foreach ($list as $k=>$v){
            foreach ($v as $kk=>$vv){
                if(preg_match('/^s\d/',$kk) && !empty($vv)){
                    $sku_arr[$k][] = $vv;
                }
            }
            $v['sku_arr'] = $sku_arr[$k];
            $list[$k] = $v;
        }
        return $list;
    }
    /**
     * 添加
     * @param $data
     */
    public function add($data){
        self::create($data);
    }

    /**
     * 编辑
     * @param $data
     */
    public function edit($data){
        self::update($data);
    }

    /**
     * 删除
     * @param $id
     */
    public function del($id){
        $this->where('id',$id)->delete();
    }

}
